{
  Определение основных типов данных и констант

 TextNameType - Имена файлов
 TextLongNameType - Полный путь файла
 TextStringType - строки
 TextFloatType - числа
 TextLogicType - логические
 TextIntegerType - целые

 ReferenceDBname - refbase.db3
 ProjectDBname - prjdata.db3
 HistoryDBname - history.db3

   версия 0.2 март 2011 prodg@ya.ru D.Kondakov
}
unit IIntgrlBaseDefs;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, DynLibs, IIntgrlTypes;

{$i calcconfig.inc}

Const
  IIntgrlVer = 1000002;

  prgStart = 'Starting...';
  prgData = '10.03.2011';
  prgCopyright = '© IntepSys';
  prgFooter = '...bye';
  pstDelim = ':';
  pstErrors = 'Errors';
  pstWarnings = 'Warnings';

  cfgDfltCntxt = 'Absolute';
  cfgFileDelim = '.';
  MainFileName = 'iintegral';
  cfgFileWinName = MainFileName + cfgFileDelim + 'ini';
  cfgFileLinName = MainFileName + cfgFileDelim + 'cfg';
  DataLogExt = 'log';
  logFileName = MainFileName + cfgFileDelim + DataLogExt;
  DataFileExt = 'ii';
  WorkFileExt =  DataFileExt + cfgFileDelim + 'w';
  PackFileExt =  DataFileExt + cfgFileDelim + 'z';
  DBFileExt = 'db3';
  ReferenceDBname = 'refbase' + cfgFileDelim + DBFileExt;
  ProjectDBname = 'prjdata' + cfgFileDelim + DBFileExt;
  HistoryDBname = 'history' + cfgFileDelim + DBFileExt;
  plgnFileExt = SharedSuffix;
{$ifdef Linux}
  prgHeader = 'ʃʃNᵗΣg®@L';
  prgCfgFileName = cfgFileLinName;
{$else}
  prgHeader = 'IINteG®@L';
  prgCfgFileName = cfgFileWinName;
{$endif}

// Имена основных модулей
  ENVmodName = 'ENV';
  CONSmodName = 'CONS';
  LOGmodName = 'LOG';
  EXECmodName = 'EXEC';
  SOLVmodName = 'SOLV';
  DBmodName = 'DB';
  LIBmodName = 'LIB';
  ACCNTmodName = 'ACCNT';
  HISTmodName = 'HIST';

type
  // Типы данных для обмена с внешними программами
  TextNameType = ansistring;
  TextLongNameType = ansistring;
  TextStringType = ansistring;
  TextFloatType = single;
  TextLogicType = byte;
  TextIntegerType = integer;

  function s2e(s: TinlStringType): TextStringType; inline;
  function f2e(f: TinlFloatType): TextFloatType; inline;
  function i2e(i: TinlIntegerType): TextIntegerType; inline;
  function l2e(l: TinlLogicType): TextLogicType; inline;

  function e2s(s: TextStringType): TinlStringType; inline;
  function e2f(f: TextFloatType): TinlFloatType; inline;
  function e2i(i: TextIntegerType): TinlIntegerType; inline;
  function e2l(l: TextLogicType): TinlLogicType; inline;

resourcestring
  hlpHelp = 'This text.';
  hlpVersion = 'Type version information for all modules.';
  hlpLog = 'Set way for the log.';
  hlpContext = 'Set default context to CONTEXT_NAME.';

  pstVer = 'ver';

  logEndModules = 'End all modules';
  logEndPlugins = 'Plugins unloaded';
  logBgnMod = 'Begin module ';
  logEndMod = 'End module ';
  logEMI = '+++';

  logNoContext = 'No context defined';
  logNoINI = 'No INI file';
  logDB = ' DB ';
  logDBread = 'Read';
  logDBopen = 'Connect';
  logDBclose = 'Close';
  logDBnames = 'Read Names from';
  logDBtables = 'Query tables';
  logDBempty = 'DB is empty. ERROR (no tables found)';

  logCreate = 'create';
  logDestroy = 'destroy';
  errNotAssigned = 'not assigned';
  errNotFound = 'not found';

implementation

function s2e(s: TinlStringType): TextStringType;
begin
  result := s;
end;

function f2e(f: TinlFloatType): TextFloatType;
begin
  result := f;
end;

function i2e(i: TinlIntegerType): TextIntegerType;
begin
  result := i;
end;

function l2e(l: TinlLogicType): TextLogicType;
begin
  if l then result := 1 else result := 0;
end;

function e2s(s: TextStringType): TinlStringType;
begin
  result := s;
end;

function e2f(f: TextFloatType): TinlFloatType;
begin
  result := f;
end;

function e2i(i: TextIntegerType): TinlIntegerType;
begin
  result := i;
end;

function e2l(l: TextLogicType): TinlLogicType;
begin
  result := l<>0;
end;

end.

